<?php

class HTech_Model_Scope extends Zend_Db_Table_Abstract
{      
    protected $_userId;
    protected $_program;
    protected $_location;
    protected $_officer;
    
    public function __construct($userId = null) 
    { 
        parent::__construct(); 
        
        $this->_userId = $userId ? $userId : Zend_Auth::getInstance()->getIdentity()->UserId;
        
        $db = $this->getAdapter();
        
        $sql = $db->quoteInto("
            select LocationId,LocationId from lnk_users_locations where UserId = ?", $this->_userId);
        $this->_location = $db->fetchPairs($sql);
        
        $sql = $db->quoteInto("
            select ProgramId,ProgramId from lnk_users_programs where UserId = ?", $this->_userId);
        $this->_program  = $db->fetchPairs($sql);
        
        $sql = $db->quoteInto("
            select OfficerId,OfficerId from lnk_users_officers where UserId = ?", $this->_userId);
        $this->_officer = $db->fetchPairs($sql);  
    }
    
    public function getScopes()
    {
        $scopes = array();
        $scopes['Location'] = $this->_location;
        $scopes['Program'] = $this->_program;
        $scopes['Officer'] = $this->_officer;
        return $scopes;
    }

    public function getUserId()
    {
        return $this->_userId;
    }

}
